set -u
context_size=$1

sudo apt-get install cmake ccache astyle -y

#llama.cpp
#git clone https://gitee.com/wangyi-fudan/llama.cpp
cd llama.cpp
current_nvcc=`which nvcc`
cmake . -DLLAMA_CUDA=ON -DLLAMA_CUDA_F16=ON -DCMAKE_CUDA_COMPILER=$current_nvcc -DCMAKE_CUDA_ARCHITECTURES=86
cmake --build . --config Release -j 8
cd ../

old_memory="n_len = 1024"
new_memory="n_len = "$context_size
cat debate.cpp | sed "s|$old_memory|$new_memory|g" > llama.cpp/examples/simple/simple.cpp
cd llama.cpp
cmake --build . --config Release -j 8
cp bin/simple ../debate
